#include "battle.h"

//玩家距离检定
int Player_Len_Check(herodata hero1, herodata hero2)
{
	printf("两位人物之间的距离为:%d\n", hero2.location - hero1.location);
	return hero2.location - hero1.location;
}

//移动检定
int Move_Check(herodata* hero1, herodata* hero2, int* choose1, int* choose2, int player_len)
{
	if (hero1->Stun == 0)
	{

		if ((*choose1 == 1 && player_len > 1)||(hero2->Stun!=0 && hero2->location-hero1->location>2))
		{
			(hero1->location)++;
			printf("'%s'前进了一格\n", hero1->name);
		}
		else if (*choose1 == 2 && hero1->location != 0 && hero2->Stun==0)
		{
			(hero1->location)--;
			printf("'%s'后退了一格\n", hero1->name);
		}
		else
		{
			printf("'%s'正在观察形势\n", hero1->name);
		}
	}
	if (hero2->Stun == 0)
	{
		if ((*choose2 == 1 && player_len > 1) || (hero1->Stun != 0 && hero2->location - hero1->location > 2))
		{
			printf("'%s'前进了一格\n", hero2->name);
			(hero2->location)--;
		}
		else if (*choose2 == 2 && hero2->location != 5 && hero1->Stun==0)
		{
			(hero2->location)++;
			printf("'%s'后退了一格\n", hero2->name);
		}
		else
		{
			printf("'%s'正在观察形势\n", hero2->name);
		}
	}

	return 0;
}